<?php

define("ROOT_DOMAIN","youximeitu.com");
define("LOCAL_DOMAIN","qqyxxiu1.com");

if($_SERVER["HTTP_HOST"])
{
	session_start();

}

if($_SERVER["HTTP_HOST"] !=  LOCAL_DOMAIN )
{
	
	$config["current_real_domain"] = ROOT_DOMAIN;
}
else 
{
	$config["current_real_domain"] = $_SERVER["HTTP_HOST"];
}
define("COOKIE_DOMAIN", ".{$config["current_real_domain"]}");						// 配置cookie域名

if($config["current_real_domain"] == LOCAL_DOMAIN  )
{
	
	define("TEST_DOMAIN",true);
	ini_set("display_errors",false);
}
else
{
	ini_set("display_errors",false);
	$config["show_tongji"] = 1;
	define("TEST_DOMAIN",false);
}
if(isset($_GET["error_debug"]))
{
	ini_set("display_errors",true);
	error_reporting(E_ALL);
}

$config["site"]["game"] = 0;			// 总站
$config["site"]["dota2"] = 801;
$config["site"]["dota"] = 901;			// dota
$config["site"]["lol"] = 902;			// lol
$config["site"]["wow"] = 903;			// wow
$config["site"]["dn"] = 904;			// wow
$config["site"]["dnf"] = 905;			// wow
$config["site"]["xyq"] = 906;	
$config["site"]["bns"] = 907;
$config["site"]["m3guo"] = 908;
$config["site"]["cf"] = 909;

$config['site_shortname'][0] = "game";
$config["site_shortname"][801] = "dota2";
$config['site_shortname'][901] = "dota";
$config['site_shortname'][902] = "lol";
$config['site_shortname'][903] = "wow";
$config['site_shortname'][904] = "dn";
$config['site_shortname'][905] = "dnf";
$config['site_shortname'][906] = "xyq";
$config['site_shortname'][907] = "bns";
$config['site_shortname'][908] = "m3guo";
$config['site_shortname'][909] = "cf";

$config["site_name"][$config["site"]["game"]] = "游戏美图";
$config["site_name"][$config["site"]["dota2"]] = "DOTA2";
$config["site_name"][$config["site"]["dota"]] = "DOTA";		
$config["site_name"][$config["site"]["lol"]] = "英雄联盟";	
$config["site_name"][$config["site"]["wow"]] = "魔兽世界";	
$config["site_name"][$config["site"]["dn"]] = "龙之谷";
$config["site_name"][$config["site"]["dnf"]] = "DNF";
$config["site_name"][$config["site"]["xyq"]] = "梦幻西游";
$config["site_name"][$config["site"]["bns"]] = "剑灵";
$config["site_name"][$config["site"]["m3guo"]] = "梦三国";
$config["site_name"][$config["site"]["cf"]] = "穿越火线";
$config["site_black_word"][$config["site"]["dota2"]][] = "梦三";
$config["site_black_word"][$config["site"]["dota2"]][] = "LOL";
$config["site_black_word"][$config["site"]["dota"]][] = "梦三";
$config["site_black_word"][$config["site"]["dota"]][] = "LOL";
$config["site_black_word"][$config["site"]["lol"]][] = "DOTA";

//$config["domain"]["youximeitu.com"]["site"] 				= $config["site"]["game"];
$config["domain"]["www.youximeitu.com"]["site"] 				= $config["site"]["game"];
$config["domain"]["game.youximeitu.com"]["site"] 				= $config["site"]["game"];
$config["domain"]["dota2.youximeitu.com"]["site"] 				= $config["site"]["dota2"];
$config["domain"]["dota.youximeitu.com"]["site"] 				= $config["site"]["dota"];
$config["domain"]["lol.youximeitu.com"]["site"] 				= $config["site"]["lol"];
$config["domain"]["wow.youximeitu.com"]["site"] 				= $config["site"]["wow"];
$config["domain"]["dn.youximeitu.com"]["site"] 				= $config["site"]["dn"];
$config["domain"]["dnf.youximeitu.com"]["site"] 				= $config["site"]["dnf"];
$config["domain"]["xyq.youximeitu.com"]["site"] 				= $config["site"]["xyq"];
$config["domain"]["bns.youximeitu.com"]["site"] 				= $config["site"]["bns"];
$config["domain"]["m3guo.youximeitu.com"]["site"] 				= $config["site"]["m3guo"];
$config["domain"]["cf.youximeitu.com"]["site"] 				= $config["site"]["cf"];

$config["domain_url"][$config["site"]["game"]] 				= "www.youximeitu.com";
$config["domain_url"][$config["site"]["dota2"]] 				= "dota2.youximeitu.com";
$config["domain_url"][$config["site"]["dota"]] 				= "dota.youximeitu.com";
$config["domain_url"][$config["site"]["lol"]] 				= "lol.youximeitu.com";
$config["domain_url"][$config["site"]["wow"]] 				= "wow.youximeitu.com";
$config["domain_url"][$config["site"]["dn"]] 				= "dn.youximeitu.com";
$config["domain_url"][$config["site"]["dnf"]] 				= "dnf.youximeitu.com";
$config["domain_url"][$config["site"]["xyq"]] 				= "xyq.youximeitu.com";
$config["domain_url"][$config["site"]["bns"]] 				= "bns.youximeitu.com";
$config["domain_url"][$config["site"]["m3guo"]] 			= "m3guo.youximeitu.com";
$config["domain_url"][$config["site"]["cf"]] 				= "cf.youximeitu.com";
//别名	
$config["site_alias"][$config["site"]["lol"]][] = "lol";	
$config["site_alias"][$config["site"]["wow"]][] = "wow";	
$config["site_alias"][$config["site"]["dnf"]][] = "地下城与勇士";	
$config["site_alias"][$config["site"]["cf"]][] = "cf";	
$config["main_domain"] = "www.youximeitu.com";



// 跟据当前域名，计算site_id, product
$config["current_domain"] = $_SERVER["HTTP_HOST"];
if (strlen($config["current_domain"]) == 0)
{
	$config["current_domain"] = $_SERVER["SERVER_NAME"];
}




//测试环境
$config['test_domain']=array(
	'qqyxxiu1.com'
	
);
if(in_array($config["current_domain"],$config['test_domain']))
{
	define('TEST_DOMAIN',1);
	$config["current_domain"]='dota.youximeitu.com';
	
	$config["main_domain"] = $config["current_real_domain"];
}



if (isset($config["domain"][$config["current_domain"]]))
{
	$config["current_site_id"] = $config["domain"][$config["current_domain"]]["site"];
	$config["current_site_name"] = $config["site_name"][$config["current_site_id"]];
	
}
else
{
	echo "Error Domain ! {$config["current_domain"]}<br/>\n";
	exit;
}



// 初始化时区
date_default_timezone_set('Asia/Shanghai');

// 初始化程序开始执行时间
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}

$program_execute_time_start = microtime_float();
$program_qapi_call_time = 0;										// 调用微群API的耗时统计
$program_wapi_call_time = 0;											// 调用微博API的耗时统计
$program_sql_call_time = 0;

?>
